﻿using System.Collections.Generic;

namespace Pathfinding
{
    public interface IAStarNode<T> where T : IAStarNode<T>
    {
        public T Parent { get; set; }
        public float SelfCost { get; set; }
        public float GCost { get; set; } //距初始状态的代价
        public float HCost { get; set; } //距目标状态的代价
        public float FCost { get; }

        /// <summary>
        /// 获取与指定节点的预测代价
        /// </summary>
        public float GetDistance(T otherNode);

        /// <summary>
        /// 获取后继（邻居）节点
        /// </summary>
        /// <param name="nodeMap">寻路所在的地图，类型看具体情况转换，
        /// 故用object类型</param>
        /// <returns>后继节点列表</returns>
        public List<T> GetSuccessors(object nodeMap);
        /* 一般比较可用以下函数
        public int CompareTo(AStarNode other)
        {
            var res = (int)(FCost - other.FCost);
            if(res == 0)
                res = (int)(HCost - other.HCost);
            return res;
        }
        */
    }
}